workspace(name = "drake_ros_examples")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "com_google_googletest",
    sha256 = "5cf189eb6847b4f8fc603a3ffff3b0771c08eec7dd4bd961bfd45477dd13eb73",  # noqa
    strip_prefix = "googletest-609281088cfefc76f9d0ce82e1ff6c30cc3591e5",
    urls = ["https://github.com/google/googletest/archive/609281088cfefc76f9d0ce82e1ff6c30cc3591e5.zip"],  # noqa
)

# Use the ROS 2 bazel rules
local_repository(
    name = "bazel_ros2_rules",
    path = "../bazel_ros2_rules",
)

load("@bazel_ros2_rules//deps:defs.bzl", "add_bazel_ros2_rules_dependencies")

add_bazel_ros2_rules_dependencies()

load("@bazel_ros2_rules//ros2:defs.bzl", "ros2_archive")

# N.B. We do *not* name this as `drake_ros` to avoid module shadowing.
# See https://github.com/bazelbuild/bazel/issues/17691
# If you wish to maintiain the name as `drake_ros` and you need Python, then
# you should ensure `legacy_create_init=False` (or an equivalent effect) is
# present:
# https://bazel.build/reference/be/python#py_binary.legacy_create_init
local_repository(
    name = "drake_ros_repo",
    path = "../drake_ros",
)

load("@drake_ros_repo//:required_packages.bzl", "DRAKE_ROS_REQUIRED_PACKAGES")
load(
    "@drake_ros_repo//:required_packages.bzl",
    "drake_ros_fail_if_missing_required_packages",
)

ROS_PACKAGES = DRAKE_ROS_REQUIRED_PACKAGES + [
    "geometry_msgs",
    "rclcpp",
    "rclpy",
    "ros2cli_common_extensions",
    "rviz2",
    "tf2_ros",
    "tf2_ros_py",
    "visualization_msgs",
]

drake_ros_fail_if_missing_required_packages(ROS_PACKAGES)

# Use ROS 2
ros2_archive(
    name = "ros2",
    include_packages = ROS_PACKAGES,
    sha256_url = "https://repo.ros2.org/ci_archives/nightly-cyclonedds/ros2-humble-linux-jammy-amd64-ci-CHECKSUM",  # noqa
    strip_prefix = "ros2-linux",
    url = "http://repo.ros2.org/ci_archives/nightly-cyclonedds/ros2-humble-linux-jammy-amd64-ci.tar.bz2",  # noqa
)

load("@drake_ros_repo//:drake.bzl", "DRAKE_SUGGESTED_VERSION")

http_archive(
    name = "drake",
    sha256 = DRAKE_SUGGESTED_VERSION.sha256,
    strip_prefix = DRAKE_SUGGESTED_VERSION.strip_prefix,
    urls = [
        DRAKE_SUGGESTED_VERSION.url,
    ],
)

load("@drake//tools/workspace:default.bzl", "add_default_workspace")

add_default_workspace()
